/// @tags:
#include <cstdio>
#include <functional>
#include <iostream>
#include <numeric>
#include <unordered_map>

using std::cin, std::cout, std::endl;

namespace BlueQuantum {

constexpr int maxn = 1e5;

int ecnt;
int heads[maxn * 2 + 1];

struct Edge {
  int v, nxt;
} e[maxn + 1];

inline void add(int u, int v) {
  e[++ecnt].v = v, e[ecnt].nxt = heads[u], heads[u] = ecnt;
}

bool vis[maxn * 2 + 1];

bool dfs(int u) {
  vis[u] = true;
  bool ans = false;
  for (int i = heads[u]; i; i = e[i].nxt) {
    int v = e[i].v;
    if (vis[v]) {
      return true;
    }
    ans |= dfs(v);
  }
  return ans;
}

int in[maxn * 2 + 1];

int main() {
  int n;
  cin >> n;
  int id = 0;
  std::unordered_map<std::string, int> map;
  for (int i = 1; i <= n; ++i) {
    std::string s, t;
    cin >> s >> t;
    if (map.find(s) == map.end()) {
      map[s] = ++id;
    }
    if (map.find(t) == map.end()) {
      map[t] = ++id;
    }
    in[map[t]]++;
    add(map[s], map[t]);
  }
  bool ans = true;
  for (int i = 1; i <= id; ++i) {
    if (in[i] == 0) {
      dfs(i);
    }
  }
  for (int i = 1; i <= id; ++i) {
    if (!vis[i]) {
      ans = false;
    }
  }
  cout << (ans ? "Yes\n" : "No\n");
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("D - Change Usernames.in", "r", stdin);
  freopen("D - Change Usernames.out", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
